// src/routes/categoryRoutes.ts
import express from 'express';
import {
    addItems, getItemsByParams, updateItem, getItemsList, getItemsPriceController, setUserItemThresholdController, updateQuantityController
} from '../controllers/itemsController';
import { tokenVerification } from '../middlewares/tokenVerification';
// 强制将 tokenVerification 转换为 RequestHandler 类型
import { RequestHandler } from 'express';

const router = express.Router();

// 添加新分类
router.post('/addItems', tokenVerification as RequestHandler, addItems);

//根据指定参数进行查询
router.get('/getItems', tokenVerification as RequestHandler, getItemsByParams);

//修改Items数据
router.post('/updateItem', tokenVerification as RequestHandler, updateItem)

// 根据指定参数获取items数据列表 
router.get('/getItemsList', tokenVerification as RequestHandler, getItemsList)

router.get('/getItemsPriceController', tokenVerification as RequestHandler, getItemsPriceController)

// 设置物品消耗阈值
router.post('/setThreshold', tokenVerification as RequestHandler, setUserItemThresholdController);

// 更新物品数量接口（消耗或者增加）
router.post('/updateQuantity', tokenVerification as RequestHandler, updateQuantityController);

export default router;
